package hibernate

class Robot {
    static hasMany = [mouths:Mouth, roles:Role] //默认支持级联添加与更新

    String name

    static mapping = {
        table "robot"

        id column:"ID"
        version column:"VERSION"

        name column:"NAME"

        roles column: "ROBOT_ID", joinTable: "robot_role" //roles joinTable: [name:"robot_role", key:"ROBOT_ID", column: "ROLE_ID"]
    }

    static constraints = {
        name(nullable: false, unique: true)
    }

}
